#!/bin/sh -ef
# create a postinstall script to perform the change afterwards

if [ -z "$GLOBAL_RELNAME" ]; then
	echo "** warning: relname feature enabled but RELNAME not set" >&2
	exit 0
fi

if [ -n "$GLOBAL_VERBOSE" ]; then
	echo "** Change /etc/altlinux-release contents to the release name" >&2
fi

SCRIPT="/usr/share/install2/postinstall.d/91-relname"
cat > "$SCRIPT" << EOF
#!/bin/sh
a= . install2-init-functions
exec_chroot sh -c 'echo "$GLOBAL_RELNAME" > /etc/altlinux-release'
exec_chroot sh -c 'grub-mkconfig -o /boot/grub/grub.cfg >&/dev/null ||:'
EOF
chmod +x "$SCRIPT"
